<?php
if( !defined('IN_INDEX') )
{
	die('This page is hidden.');
}
include('inc/functions_gym.php');
?>
<script type="text/javascript">
var dhtmlgoodies_slideSpeed = 50;	// Higher value = faster
var dhtmlgoodies_timer = 1;	// Lower value = faster

var objectIdToSlideDown = false;
var dhtmlgoodies_activeId = false;
var dhtmlgoodies_slideInProgress = false;

var dhtmlgoodies_expandMultiple = false;

function showHideContent(e,inputId)
{
	if(dhtmlgoodies_slideInProgress)return;
	dhtmlgoodies_slideInProgress = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var answerDiv = document.getElementById('dhtmlgoodies_a' + numericId);

	objectIdToSlideDown = false;

	if(!answerDiv.style.display || answerDiv.style.display=='none'){
		if(dhtmlgoodies_activeId &&  dhtmlgoodies_activeId!=numericId && !dhtmlgoodies_expandMultiple){
			objectIdToSlideDown = numericId;
			slideContent(dhtmlgoodies_activeId,(dhtmlgoodies_slideSpeed*-1));
		}else{

			answerDiv.style.display='block';
			answerDiv.style.visibility = 'visible';

			slideContent(numericId,dhtmlgoodies_slideSpeed);
		}
	}else{
		slideContent(numericId,(dhtmlgoodies_slideSpeed*-1));
		dhtmlgoodies_activeId = false;
	}
}

function slideContent(inputId,direction)
{

	var obj =document.getElementById('dhtmlgoodies_a' + inputId);
	var contentObj = document.getElementById('dhtmlgoodies_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',dhtmlgoodies_timer);
	}else{
		if(height<=1){
			obj.style.display='none';
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.display='block';
				document.getElementById('dhtmlgoodies_a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,dhtmlgoodies_slideSpeed);
			}else{
				dhtmlgoodies_slideInProgress = false;
			}
		}else{
			dhtmlgoodies_activeId = inputId;
			dhtmlgoodies_slideInProgress = false;
		}
	}
}

function initShowHideDivs()
{

	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='divQuestion'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'dhtmlgoodies_q'+divCounter;
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'dhtmlgoodies_a'+divCounter;
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px';
			contentDiv.className='divAnswer_content';
			contentDiv.id = 'dhtmlgoodies_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}
	}
}
</script>
<?php
if(!checkSession())
{
			function redirect($url)
			{
			?>
				<script type="text/javascript">
					{
					window.location = "<?php echo $url?>";
					}
				</script>
			<?php 
			}
			redirect("index.php?action=login");
	exit;
}
else
{
?>
<?php 
	include('inc/functions_blog.php');
	
	$show_what = (isset($_GET['show'])) ? $_GET['show']:'all';
	switch ($show_what){
		case 'all':
		case 'group':	
			$latestWorkouts = listLatestWorkouts(getSettings('settings_trainings_to_show'));break;
		case 'friends':
			$latestWorkouts = listFriendsWorkouts(getSettings('settings_trainings_to_show'));break;
		case 'myfollowing':
			$latestWorkouts = listFollowingWorkouts(getSettings('settings_trainings_to_show'));break;
	}
?>
<!-- Frontpage START -->

<!-- Drift message START -->
<?php 
if(getSettings('settings_drift_message') != "")
{
?>
    <div style='float: left; clear: right; padding-right: 2px;'>
    <img src="./img/info.png" alt="<?php echo translate('message_drift'); ?>" />
    </div>
     <?php echo getSettings('settings_drift_message'); ?>
    <br /><br />
<?php 
}
?>
<!-- Drift message END -->
<div id="like_popup_view" style="display:none;"></div>
 
<table width="100%" border="0">

	<!-- Upper cols START-->
    <tr>
    
    <!-- Latest workouts START -->
    <td valign="top" rowspan="2" width="500">
    <h2><?php echo translate('lastworkouts'); ?></h2>
    <div id="kind_of_display">
    <?php 
    	$show_options_array = array('all','group','friends','myfollowing');
    	$selectbox_content= "";
    	$selected_option = (isset($_GET['show'])) ? $_GET['show']:'all';
    	foreach ($show_options_array as $option){
    		$selected = ($selected_option == $option) ? ' selected="selected"':'';
    		$selectbox_content .= "<option value='$option' $selected>".translate("{$option}_show")."</option>";
    	}	
    	 
    ?>
    	<select onchange="redirect_to(this.value);">
    		<?php echo $selectbox_content;?>
    	</select>
    </div>
        <table width="480" border="0" cellspacing="0" cellpadding="0" id="latest_workout">

		<?php 
		//	$latestWorkouts = array_reverse($latestWorkouts);
			foreach ($latestWorkouts as $key => $val )
			{ 
			$USER_PROFILE = new User('id', $val['user_id']);
			echo "<tr height=\"10\"><td colspan='2'><hr style='display: block;
			position: relative;
			padding: 0;
			margin: 8px auto;
			width: 100%;
			clear: both;
			border: none;
			border-top: 1px solid #AAA;
			border-bottom: 1px solid #FFF;
			font-size: 1px;
			line-height: 0;
			overflow: visible;' /></td></tr>";
			?>
            
			<tr>
            <td width="8%" rowspan="3" align="left" style="padding-right:10px;" valign="top" >
            
            
         <?php
		 // Get profile picture :)
		if($USER_PROFILE->getAvatarpath() != "")
		{
			$profile_pic_path = $CONFIG['user_data_path'] . $USER_PROFILE->getId() . "/thumbs_" . $USER_PROFILE->getAvatarpath();
			if(file_exists($profile_pic_path))
			{
				echo "<a href='index.php?action=profile&amp;id=" . $val['user_id'] . "'><img style='background: url(" . $profile_pic_path . ") no-repeat 50%; height: 60px; width: 60px;' src=\"" . $profile_pic_path . "\" alt=\"" . translate('profile_picture') . "\" /></a>\n";
			}
			else
			{
				echo "";//$profile_pic_path;
			}
		}
		else
		{
			if($USER_PROFILE->getGender() == "female")
			{
				echo "<center><a href='index.php?action=profile&amp;id=" . $val['user_id'] . "'><img src=\"" . $CONFIG['user_data_path'] . "profile_female.gif\" height='60' width='60' alt=\"" . translate('profile_picture') . "\" /></a></center>\n";
			}
			else
			{
				echo "<center><a href='index.php?action=profile&amp;id=" . $val['user_id'] . "'><img src=\"" . $CONFIG['user_data_path'] . "profile_male.gif\" height='60' width='60' alt=\"" . translate('profile_picture') . "\" /></a></center>\n";
			}
		}
		// Get profile picture END
		?>
           
          	</td>
            
			<td width="92%">
            <a style='color:#555555;' href="index.php?action=profile&amp;sub=show&amp;tid=<?php echo $val['training_id']; ?>"> <b> <?php echo ($val['title']); ?></b></a>
             
             <?php 
			 // Display time used on training
			 if($val['timespent_minutes'] != 0 || $val['timespent_hours'] != 0)
			 {
			?>
                <?php 
					//Display time user on training
				
					// Hours only
					if($val['timespent_hours'] > 0 && $val['timespent_minutes'] == 0)
					{
						echo "(" . $val['timespent_hours'] . translate('hours_short') . ")"; 
					}
					
                	// Hours and minutes, hours 
					elseif($val['timespent_hours'] > 0)
					{
						echo "(" . $val['timespent_hours'] . translate('hours_short');
					}
					// The And
					if($val['timespent_minutes'] > 0 && $val['timespent_hours'] > 0)
					{
						echo " " . strtolower(translate('and')) . " ";
					}
                 	
					// Minutes only
					if($val['timespent_minutes'] > 0 && $val['timespent_hours'] == 0)
					{
						echo "(" . $val['timespent_minutes'] . translate('minutes_short'). ")";
					}
					// Hours and minutes, minutes
					elseif($val['timespent_minutes'] > 0)
					{
						echo $val['timespent_minutes'] . translate('minutes_short') . ")";
					}
                ?>
            <?php
			 }
			 ?>
            </td>
            </tr>
            
            <tr>
            	<td>
            <?php 
			// Catch comments from training
			echo strip_tags(substr($val['comment'], 0, 130)) . "..."; 
			?>
            	</td>
            </tr>
            
            <tr>
               <td>
               <font size="1">
                <div style='float: left; clear: right; padding-right: 2px;'><img src="img/flags/16/<?php echo strtolower($USER_PROFILE->getCountry()); ?>.png" alt="<?php echo $USER_PROFILE->getCountry(); ?>" /></div> 
                <a style='color:#555555;' href="index.php?action=profile&amp;id=<?php echo $val['user_id']; ?>"> <?php echo $USER_PROFILE->getFirstname() . " " . ucf($USER_PROFILE->getLastname()); ?></a>  <?php echo translate('for'); ?> <?php echo getHowLongAgo($val['date']); ?>. 
                <?php if(getCommentTraining($val['training_id']) >= 0):?>
				   <a class="detect_click" rel="<?php echo $val['training_id'];?>" onclick="javascript:open_comments(<?php echo $val['training_id'];?>,<?php echo $val['user_id'];?>);" style="text-decoration:none; color:#555555;" href="javascript:void(0);"><img src="./img/comments.png" alt="<?php echo translate('comments'); ?>" /> <?php echo (getCommentTraining($val['training_id']) >0)?getCommentTraining($val['training_id']):""; ?></a>
                <?php else:?> 
					
				<?php endif;?>
				
                <?php if(getVideosTraining($val['training_id']) >= 1)
				{
				?>
                <img src="./img/video.png" alt="<?php echo translate('videos'); ?>" /> <?php echo getVideosTraining($val['training_id']); ?>
                <?php
				}
				?>
				<a href="javascript:void(0);" onclick="open_who_likes(<?php echo $val['training_id'];?>);"><img src="./img/thumb_up.png" alt="<?php echo translate('like');?>" /></a>
				<span class="like" rel="<?php echo $val['training_id'];?>"> <?php echo (count_numberOfPersons_like($val['user_id'], $val['training_id'])>0)? count_numberOfPersons_like($val['user_id'], $val['training_id']):"";?>
                <?php if(is_like($val['user_id'],$_SESSION['user_id'], $val['training_id'])):?>
                	<a href="javascript:void(0);" onclick="like_unlike('unlike',<?php echo $_SESSION['user_id'];?>,<?php echo $val['user_id'];?>,<?php echo $val['training_id'];?>);" ><?php echo translate('unlike');?></a>
                <?php else:?>
                	<a href="javascript:void(0);" onclick="like_unlike('like',<?php echo $_SESSION['user_id'];?>,<?php echo $val['user_id'];?>,<?php echo $val['training_id'];?>);" ><?php echo translate('like');?></a>
                <?php endif;?>
                </span>
				
				<?php echo "&nbsp;".ui_aj_follow_this_user($val['user_id'], $val['user_id']);?>
                </font>
				<?php 
					$three_comments = UI_get_3_latest_comments($val['user_id'], $val['training_id']);
					if($three_comments == ''){
						$hidden = " hidden";
					}else{
						$hidden = "";
					}
				?>
                <div class="clear comment_div<?php echo $hidden;?>" id="<?php echo $val['training_id'];?>">
					<?php echo $three_comments;?>
				</div>
               </td>
            </tr>
            
            
            <?php  } ?>
    	</table>
        
        <hr style="display: block;
        position: relative;
        padding: 0;
        margin: 8px auto;
        width: 100%;
        clear: both;
        border: none;
        border-top: 1px solid #AAA;
        border-bottom: 1px solid #FFF;
        font-size: 1px;
        line-height: 0;
        overflow: visible;"/>
        
        <!-- Random profile START-->
        <?php 
		$randomWorkout = showRandomWorkout();
		?>
        
        <h2><?php echo translate('showrandomworkout'); ?></h2>
        
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        
        <?php foreach ($randomWorkout as $kkey => $vval )
			{ 
			$USER_PROFILE = new User('id', $vval['user_id']);
			echo "<tr height=\"10\"><td colspan='2'><hr style='display: block;
			position: relative;
			padding: 0;
			margin: 8px auto;
			width: 100%;
			clear: both;
			border: none;
			border-top: 1px solid #AAA;
			border-bottom: 1px solid #FFF;
			font-size: 1px;
			line-height: 0;
			overflow: visible;' /></td></tr>";
			?>

			<tr>
            <td width="8%" rowspan="4" align="left" style="padding-right: 5px;">
            <?php
		if($USER_PROFILE->getAvatarpath() != "")
		{
			$profile_pic_path = $CONFIG['user_data_path'] . $USER_PROFILE->getId() . "/thumbs_" . $USER_PROFILE->getAvatarpath();
			if(file_exists($profile_pic_path))
			{
				echo "<a href='index.php?action=profile&amp;id=" . $vval['user_id'] . "'><img style='background: url(" . $profile_pic_path . ") no-repeat 50%; height: 60px; width: 60px;' src=\"" . $profile_pic_path . "\" alt=\"" . translate('profile_picture') . "\" /></a>\n";
			}
			else
			{
				echo '';//$profile_pic_path;
			}
		}
		else
		{
			if($USER_PROFILE->getGender() == "female")
			{
				echo "<center><a href='index.php?action=profile&amp;id=" . $vval['user_id'] . "'><img src=\"" . $CONFIG['user_data_path'] . "profile_female.gif\" height='60' width='60' alt=\"" . translate('profile_picture') . "\" /></a></center>\n";
			}
			else
			{
				echo "<center><a href='index.php?action=profile&amp;id=" . $vval['user_id'] . "'><img src=\"" . $CONFIG['user_data_path'] . "profile_male.gif\" height='60' width='60' alt=\"" . translate('profile_picture') . "\" /></a></center>\n";
			}
		}
		?>
          	</td>
            
			<td width="92%">
            <a style='color:#555555;' href="index.php?action=profile&amp;sub=show&amp;tid=<?php echo $vval['training_id']; ?>"> <b> <?php echo $vval['title']; ?></b></a>
            <?php 
			 if($vval['timespent_minutes'] != 0 || $vval['timespent_hours'] != 0)
			 {
			?>
				<?php 
					//Display time user on training
				
					// Hours only
					if($vval['timespent_hours'] > 0 && $vval['timespent_minutes'] == 0)
					{
						echo "(" . $vval['timespent_hours'] . translate('hours_short') . ")"; 
					}
					
                	// Hours and minutes, hours 
					elseif($vval['timespent_hours'] > 0)
					{
						echo "(" . $vval['timespent_hours'] . translate('hours_short');
					}
					// The And
					if($vval['timespent_minutes'] > 0 && $vval['timespent_hours'] > 0)
					{
						echo " " . strtolower(translate('and')) . " ";
					}
                 	
					// Minutes only
					if($vval['timespent_minutes'] > 0 && $vval['timespent_hours'] == 0)
					{
						echo "(" . $vval['timespent_minutes'] . translate('minutes_short'). ")";
					}
					// Hours and minutes, minutes
					elseif($vval['timespent_minutes'] > 0)
					{
						echo $vval['timespent_minutes'] . translate('minutes_short') . ")";
					}
                ?>            
			<?php
			 }
			 ?>
            </td>
            </tr>
            
            <tr>
               <td>
                 <?php 
			// Catch comments from training
			echo substr($vval['comment'], 0, 130) . "..."; 
			?>
               </td>
            </tr>
            
            <tr>
                <td>
                <font size="1">
                <div style='float: left; clear: right; padding-right: 3px;'><img src="img/flags/16/<?php echo strtolower($USER_PROFILE->getCountry()); ?>.png" alt="<?php echo $USER_PROFILE->getCountry(); ?>" /></div> <a style='color:#555555;' href="index.php?action=profile&amp;id=<?php echo $vval['user_id']; ?>"> <?php echo ucf($USER_PROFILE->getFirstname()) . " " . ucf($USER_PROFILE->getLastname()); ?></a> <?php echo translate('for'); ?> <?php echo getHowLongAgo($vval['date']); ?>.
                <?php if(getCommentTraining($vval['training_id']) >= 1)
				{
				?>
				 <a class="detect_click" rel="<?php echo $vval['training_id'];?>" style="text-decoration:none; color:#555555;" href="javascript:void(0);">
                	<img src="./img/comments.png" alt="<?php echo translate('comments'); ?>" /> <?php echo getCommentTraining($vval['training_id']); ?>
                 </a>
				<?php
				}
				?>
                </font>
                 <div class="clear comment_div hidden" id="<?php echo $vval['training_id'];?>">
                 
                 </div>
                </td>
            </tr>
<!-- Random profile END-->
            
            <?php } ?>
            
           </table>
           
         <hr style="display: block;
        position: relative;
        padding: 0;
        margin: 8px auto;
        width: 100%;
        clear: both;
        border: none;
        border-top: 1px solid #AAA;
        border-bottom: 1px solid #FFF;
        font-size: 1px;
        line-height: 0;
        overflow: visible;"/>
           
    </td>
 	<!-- Latest workouts END -->
    
    <!-- Toplist START -->
    <td style="padding-left:20px;" valign="top" width="400">
    
    <h2><?php echo translate('newtodayheader'); ?></h2>
    <br />
    <div style='float: left; clear: right; padding-right: 3px;'><img src="img/user_add.png" alt="<?php echo translate('members'); ?>" /></div> <?php echo ucf(translate('members')); ?>: 
	<?php  
	if(countNewMembersToday() == 0)
	{
	echo countNewMembersToday(); 
	}
	elseif(countNewMembersToday() > 0)
	{
	echo "<a href='index.php?action=blogs' style='color:#555555;'>" . countNewMembersToday() . "</a>";
	}
	?>
    <div style="clear: both;"></div>
    <div style='float: left; clear: right; padding-right: 3px;'><img src="img/film_add.png" alt="<?php echo ucf(translate('comments')); ?>" /></div> <?php echo ucf(translate('videos')); ?>: 
    <?php  
	if(countNewVideosToday() == 0)
	{
	echo countNewVideosToday(); 
	}
	elseif(countNewVideosToday() > 0)
	{
	echo "<a href='index.php?action=home&sub=videos' style='color:#555555;'>" . countNewVideosToday() . "</a>";
	}
	?>
    <div style="clear: both;"></div>
    <div style='float: left; clear: right; padding-right: 3px;'><img src="img/com_add.png" alt="<?php echo ucf(translate('comments')); ?>" /></div> <?php echo ucf(translate('comments')); ?>: <?php echo countNewCommentsToday(); ?>
    <div style="clear: both;"></div>
    <div style='float: left; clear: right; padding-right: 3px;'><img src="img/clock_add.png" alt="<?php echo ucf(translate('timespent')); ?>" /></div> <?php echo ucf(translate('timespent')); ?>: <?php echo countTimeHoursToday(); ?><?php echo translate('hours_short'); ?>
    <div style="clear: both;"></div>
    <div style='float: left; clear: right; padding-right: 3px;'><img src="img/training_add.png" alt="<?php echo ucf(translate('trainings')); ?>" /></div> <?php echo ucf(translate('trainings')); ?>: <?php echo countNewBlogsToday(); ?>
    <div style="clear: both;"></div>
    <div style='float: left; clear: right; padding-right: 3px;'><img src="img/chart_curve_add.png" alt="<?php echo ucf(translate('lifted')); ?>" /></div> <?php echo ucf(translate('lifted')); ?>: 
	<?php
        if($w_metric == "kg")
			{
			?><?php echo countKgLiftedToday() ." ". $w_metric; ?> / <?php echo countTonLiftedToday(); ?> <?php echo translate('ton'); ?> 
			<?php
			}
			else
			{
				echo countLbsLiftedToday()." ". $w_metric;
			}
		?>
    <div style="clear: both;"></div>
    <br />
    
	<div id="view_gym" style="display:none;width:550px;height:500px;overflow:auto;"></div>

<script type="text/javascript">
	function open_popup_gym_pending(){
	  	$.post("index2.php",{action:'gym',task:'list_pendding_gyms'}, function(res){
       			$('#view_gym').html(res);
       		 });
						   
	  	$("#view_gym").dialog(
			{ 
				dialogClass: 'dialog',
				width:550,
				height:500,
				 buttons: [
					           {
					               text: "OK",
					               click: function(){ 
					               		$(this).dialog("close"); 
					               	}
					           }
				           ] 
			}
		);	
 	}
</script>
	
	<?php if(who_am_i()== 'ADMIN' || who_am_i()== 'MOD'): ?>
		<a href="javascript:void(0);" onclick="open_popup_gym_pending();"><div style='float: left; clear: both; padding-right: 5px;'><img src='img/house.png' /></div><?php echo translate('gym_pendding')." ( ".count_number_gyms_need_activate()." ) ";?></a>
	<?php endif;?>
	<div style="clear: both;"></div>
    <br />
    <div style='float: left; clear: right; padding-right: 3px;'><img src="img/training_add.png" alt="<?php echo ucf(translate('trainings')); ?>" /></div> <a style='color:#555555; font-weight: bold;' href="index.php?action=profile&amp;sub=newt"><?php echo ucf(translate('newtraining')); ?></a>
    <div style="clear: both;"></div>
    <br />
    
    <h2><?php echo translate('lastcomments'); ?></h2>
        <br />
        <?php 
		// Display latest comments
			if(count(getAllComments(getSettings('settings_comments_to_show'))) > 0)
			 {
				 foreach(getAllComments(getSettings('settings_comments_to_show')) as $key => $val)
				 {
					 if($val['post_type'] == "training")
					 {
						 $U_PROFILE = new User('id', $val['user_id']);
						 echo ucf(translate('to')) . " <a href='index.php?action=profile&amp;sub=show&amp;tid=" . $val['post_id'] . "' title='" . htmlspecialchars(substr($val['comment'], 0, 40))."..'>". substr(getTrainingTitle($val['post_id']), 0, 30) ."</a> 
						 ". strtolower(translate('by')) ."
						 <a href='index.php?action=profile&amp;id=". $U_PROFILE->getId() ."'>" . $U_PROFILE->getFirstname() . " " . $U_PROFILE->getLastname() . "</a> <br /> ";
					 }
					 if($val['post_type'] == "news")
					 {
						 $U_PROFILE = new User('id', $val['user_id']);
						 echo ucf(translate('to')) . " <a href='index.php?action=news&amp;sub=show&amp;nid=" . $val['post_id'] . "' title='" . htmlspecialchars(substr($val['comment'], 0, 40))."..'>". getNewsTitle($val['post_id']) ."</a> 
						 ". strtolower(translate('by')) ."
						 <a href='index.php?action=profile&amp;id=". $U_PROFILE->getId() ."'>" . $U_PROFILE->getFirstname() . " " . $U_PROFILE->getLastname() . "</a> <br /> ";
					 }
				 }
			 }
		?>
    <br />
    
    <script type="text/javascript">
    function showonlyone(thechosenone) {
      var newboxes = document.getElementsByTagName("div");
            for(var x=0; x<newboxes.length; x++) {
                  name = newboxes[x].getAttribute("name");
                  if (name == 'newboxes') {
                        if (newboxes[x].id == thechosenone) {
                        newboxes[x].style.display = 'block';
                  }
                  else {
                        newboxes[x].style.display = 'none';
                  }
            }
     	 }	
	}
	</script>
    
    <h2><?php echo translate('toplists'); ?></h2>
    
    <div style="clear:both"></div>
    <div class="floated">
    <div class="divQuestion"><a style='color:#555555; font-weight: bold;' href="#"><?php echo translate('mostvisited'); ?></a></div>
    <div class="divAnswer">
        <div>
            <?php
			getMostReadUsersList();
			?>
        </div>
    </div>
    </div>
    
    <div style="clear:both"></div>
    
    <div class="floated">
    <div class="divQuestion"><a style='color:#555555; font-weight: bold;' href="#"><?php echo translate('mostactive'); ?></a></div>
    <div class="divAnswer">
        <div>
            <?php
			getActiveUsersTopList();
			?>
        </div>
    </div>
    </div>
    
    <div style="clear:both"></div>
    <div class="floated">
    <div class="divQuestion"><a style='color:#555555; font-weight: bold;' href="#"><?php echo translate('randomlist'); ?></a></div>
    <div class="divAnswer">
        <div>
            <?php
			getRandomUsersList();
			?>
        </div>
    </div>
    </div>
	<div style="clear:both"></div>
<script type="text/javascript">
 initShowHideDivs();
 showHideContent(false,1); // Automatically expand first item
 </script>
 
		<?php 
		//Display latest news
		if(count(getAllNews(getSettings('settings_news_to_show'))) > 0)
		{
		?>
        <br />
        <h2><?php echo translate('latestnews'); ?></h2>
        <?php 
		
			if(count(getAllNews(getSettings('settings_news_to_show'))) > 0)
			 {
				 foreach(getAllNews(getSettings('settings_news_to_show')) as $key => $val)
				 {
				$U_PROFILE = new User('id', $val['user_id']);
				$title = $U_PROFILE->getFirstname() . " " . $U_PROFILE->getLastname();
				echo "<br />
				<a style='font-weight: bold; color:#555555;' href='index.php?action=news&amp;sub=show&amp;nid=" . $val['id'] . "' title='" . $title ."'>". getNewsTitle($val['id']) ."</a>
				<br />" . ucf(translate('for')) . " " . getHowLongAgo($val['date']) . " " . translate('by') . " " . $title ."<br />
				<a style='font-weight: bold; color:#555555;' href='index.php?action=news&amp;sub=show&amp;nid=" . $val['id'] . "' title='" . $title ."'>". translate('readmore') ."..</a><br />";
				 }
			 }
		}
		?>
        </td>
    <!-- Toplist END -->
    </tr>
    <!-- Upper cols END-->
    
    <!-- Lower cols START-->

  
    <!-- Lower cols END-->
</table>
<?php  } ?>